package com.pxx.item.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pxx.item.mapper.TbSpecParamMapper;
import com.pxx.item.pojo.TbSpecGroup;
import com.pxx.item.pojo.TbSpecParam;
import com.pxx.item.service.TbSpecGroupService;
import com.pxx.item.mapper.TbSpecGroupMapper;
import com.pxx.item.service.TbSpecParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Collections;
import java.util.List;

/**
* @author Yoo19
* @description 针对表【tb_spec_group(规格参数的分组表，每个商品分类下有多个规格参数组)】的数据库操作Service实现
* @createDate 2025-06-26 18:25:18
*/
@Service
public class TbSpecGroupServiceImpl extends ServiceImpl<TbSpecGroupMapper, TbSpecGroup>
    implements TbSpecGroupService{
    @Autowired
   private TbSpecGroupMapper tbSpecGroupMapper;
    @Autowired
    private TbSpecParamMapper tbSpecParamMapper;


    @Override
    public List<TbSpecGroup> queryGroupByCid(Long cid) {

        QueryWrapper<TbSpecGroup> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("cid",cid);

        List<TbSpecGroup> specGroupList = tbSpecGroupMapper.selectList(queryWrapper);

        return specGroupList;
    }

    @Override
    public void addGroup(TbSpecGroup tbSpecGroup) {
        tbSpecGroupMapper.insert(tbSpecGroup);
    }

    @Override
    public void updateGroup(TbSpecGroup tbSpecGroup) {
        tbSpecGroupMapper.updateById(tbSpecGroup);
    }

    @Override
    public void deleteGroup(Long id) {
        tbSpecGroupMapper.deleteById(id);
    }


}




